package io.zerous.engine.math

/**
 * Created by Zerous on 2018/2/15.
 */
class Rectangle(var x: Float, var y: Float, var width: Float, var height: Float) {
    fun includes(point: Vector2): Boolean = includes(point.x, point.y)

    fun includes(px: Float, py: Float): Boolean = (px in x..x+width && py in y..y+height)

    fun overlaps(rect: Rectangle): Boolean =
            (  includes(rect.x, rect.y)
            || includes(rect.x, rect.y + rect.height)
            || includes(rect.x + rect.width, rect.height)
            || includes(rect.x + rect.width, rect.y + rect.height))
}